# $Id$
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: György Balló <ballogy@freestart.hu>

pkgname=geoclue2
pkgver=2.4.7
pkgrel=1
pkgdesc="Modular geoinformation service built on the D-Bus messaging system"
arch=(i686 x86_64)
url="https://www.freedesktop.org/wiki/Software/GeoClue/"
license=(LGPL)
depends=(libsoup json-glib libmm-glib avahi)
makedepends=(intltool geoip python2 systemd gobject-introspection gnome-common git)
optdepends=('geoip: geoip-lookup server binary')
backup=(etc/geoclue/geoclue.conf)
_commit=91bf1790b7220c7ecc96cddc284690a924cd9449  # tags/2.4.7^0
source=("git+https://anongit.freedesktop.org/git/geoclue#commit=$_commit")
sha256sums=('SKIP')

# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
# Note: These are for Arch Linux use ONLY. For your own distribution, please
# get your own set of keys. Feel free to contact foutrelis@archlinux.org for
# more information.
_google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM

# Mozilla API keys (see https://location.services.mozilla.com/api)
# Note: These are for Arch Linux use ONLY. For your own distribution, please
# get your own set of keys. Feel free to contact heftig@archlinux.org for
# more information.
_mozilla_api_key=16674381-f021-49de-8622-3021c5942aff

pkgver() {
  cd geoclue
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd geoclue
  sed -e "s/key=geoclue/key=$_mozilla_api_key/" \
      -e "s/key=YOUR_KEY/key=$_google_api_key/" \
      -i data/geoclue.conf.in
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd geoclue
  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
    --libexecdir=/usr/lib/$pkgname --disable-static --enable-gtk-doc
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd geoclue
  make DESTDIR="$pkgdir" install
}
